<html>
<head>
  <title>
    <?php 
      echo "YXXY";
    ?>
  </title>
  <style>
	td.cellHeaderResult{
		border-style: solid;
		border-width:1px;
		border-color:black;
		text-align:center;
		font-weight:bold;
		padding-left:5px;
		color:blue;
	}
	
	td.cellResult{
		border-style: solid;
		border-width:1px;
		border-color: black;
		padding-left:5px;
		padding-right:3px;
		color:black;
	}
  </style>
</head>
<body>
<?php
//richiesta per prova: http://[url_sito]/xxxx.php?k=2&q=dCApwJOgbloNT8E3n6pM7BvJ
//include "cfg.php";
     include 'cUrl.php';
    
    
     

	$base64_chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
	$otp[0]="TM8m6JKJrqhPif3zQiF8FwKg+sY8lh4Un9A19BIE86Wa7NRsM/t3tjwjBboOwNjKxNnkfB2PZA/Kawlwaswm0BnDNczhY5UuWMoumtMKIddsklJR230Dd9WwmjXCOU2gsRzNI2KtfleWj6fnTirhEQQZ23HCVK8zn9/Sx7J/tHk4e/NrEwurpVbcAaXQuIXVoqvl7N1YYrz9rY72pc+lcQJRiiSXj5QlvPPzQow26WT9hdwnfhmSJy5YgdDY6d0faOOcJHlBsHqF9MvExq4BS+b9W3TzkX8chzjSPUeX8kmCHzaUt/nQlyNczQGSzxdVLOkJod0dMgFtYY2ic+Flws3umGf+NMkKHQ34OQrQKJDEtfEbaj11s4lfW2jh92PA87lHg9ULS1amoyAGCEkqWuePrYiYtJST5DIy686cPpj2d+2j1cf5RlpOcWbIb7dIiHslqOMFJHbsLnyth+jQqYCUZ5VjhxBTLaUWRR5mQZvJK9C1ktndYNdJEYLw4okYGHgwTbcPE8ARp4Jc3g/zKj6+8KR4FItn0XDCcRiIRXYcMMgMOv5YpwOjMizIKjK8OYcR1G/l+2izLeywpFqVOV+EJf26eZ9uMbNzvOWHwUayOaYuvDeF40u5aYIVQFHk4zmvQ+Aauil66L1uHHKa641YtUYXGB3qN15a0pdxCDXWPz+PiZNJ7sqA9NB8moUsr6sF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W73pWGMGvv3saGQtjDmAwlgj979CSWW0FpEO7et4LCuF9Vg7dQFsZ2fxaUraIJzYZDnwCCxFVt1u3bloaClCRqaOKTznySwBOVs6tw5ae/WsBw6/uDAGjxHuoZmuOKSC8zghvq6qIKjRTuMaZ05vSqdcO9STJLMUtTwNQYPDIV9YN1b6MMVZRjwRVDTyYmg9+PkA+/JAk1n8sFPYhYG91yDKie3MEdqh1Aa9Qa7NCU0b7zlQ07QAfjHLMadfH97GKFHrqRHHc57g+nOv5mYJNpBR5Ox29cFFYtR1s5ljzJkmomNlMumhky5gE1ybfRJ/z1IQVYD/A0WEFapTBLpP1kgm0wx2HJDi/kyye9Pzrmgvc0bpLfaUn5KPUhblnM42x0Egn30E72kODwK/VHqovu6Fajd8hqMeup+ow6BUqVYxV7LkXcQfiPHC5+FEa4jRpFgayiPaGW+aWIwfY5lFas8ei7ux196yyGHPbxx1N1ZLRtsxOmsgSe39JB32zdlIbLnPAgEmHv4kTwM1P9iOQZfUPKGZ56BvQQwFFcwuiFZilSpY1Cn26W4CsTA1ZqsMuITCAGvzM0rLA8u8htj3TL05YtZyb6U3ZM0d+nYuSzpFrtCvkDUsH05iUaqSs9XRgzxzIR96U1lfhuOrqqOYmnwkSRIk8FBVcXl37OnSGaXRPZBlL/nCv/r4CNg2IZ9PzQCJJXwcD7RLQeU4QjZ9d+mdrs";


	main();
	
	function main(){
		global $is_root, $others;
		$q =  base64_encode("select * from pa");
		$key = 1;

		$q = cripta($q, $key);
		echo "<div>risultato query:</div>";
		//$result=get_url_contents("http://passatoremoto.altervista.org/xxxx.php?k=$k&q=$q");
		$c = new cUrl(false);
		$result=$c->get("http://passatoremoto.altervista.org/xxxx.php?k=$key&q=$q");
		echo "<div>$result</div>";

		/*try{
			if($q != "" && $key != ""){
				$real_query = base64_decode(decripta($q, $key));
				echo "<div id='query_received'>query ricevuta $real_query</div>";
				$result = execute_query($real_query);
				echo "<div id='request_result_status'>OK</div>";
				if($is_root){
					foreach($others as $i => $url){
						/*$req = new HttpRequest($url . "/xxxx.php", HttpRequest::METH_GET);
						$req->addQueryData(array("k"=>$key));
						$req->addQueryData(array("q"=>$q));* /
						try{
							//$req->send();
							echo "<div id='result_from_son_$i'>";
							//echo $url . ": " . $req->getResponseCode();
							echo get_url_contents($url . "/xxxx.php?k=$k&q=$q");
							echo "</div>";
						}catch(Exception $url_ex){
						}
					}
				}
			}
		}catch(Exception $ex){
			echo "<div id='request_result_status'>ERROR</div>";
			$result = $ex;
		}
		echo "<div id='request_results'>$result</div>";*/
	
	} //end main

	function execute_query($query){
		$result_text="";
		$blnError=false;
		global $address_db, $user_db, $pwd_db, $nome_db; //variabili importate dal file cfg.php
		try{
			$con = mysql_connect($address_db, $user_db, $pwd_db);
			
			mysql_select_db($nome_db, $con);
			echo mysql_error($con);
			$result = mysql_query($query, $con);
			if(mysql_error($con) == ""){
				echo "numero righe risultanti: " . mysql_num_rows($result) . "<br />\n";
				$result_text = "<table border='0' cellpadding='0' cellspacing='0'>";
				$written_col_names=false;
				while($row=mysql_fetch_array($result,MYSQLI_NUM)){
					//scrive le colonne
					if(!$written_col_names){
						$result_text = $result_text . "<thead>";
						for($i=0; $i < count($row); $i++){
							$result_text = $result_text . "<td class='cellHeaderResult'>";
							$result_text = $result_text . mysql_field_name($result, $i);
							$result_text = $result_text . "</td>";
						}
						$result_text = $result_text . "</thead>";
						$written_col_names=true;
					}
					//scrive la riga
					$result_text = $result_text . "<tr>";
						for($i=0; $i < count($row); $i++){
							$result_text = $result_text . "<td class='cellResult'>";
							$result_text = $result_text . $row[$i];
							$result_text = $result_text . "</td>";
						}				
					$result_text = $result_text . "</tr>";
				}
				$result_text = $result_text . "</table>";				
			}else{
				$result_text = mysql_error($con);
				$blnError = true;
			}

		}catch(Exception $ex){
			$result_text = $ex->getMessage();
			$blnError=true;
		}
		mysql_free_result($result);
		mysql_close($con);
		if($blnError) throw new Exception($result_text);
		return $result_text;
		
	}//end execute_query
	
	function cripta($testo, $id_chiave){
		return cifra($testo, $id_chiave, 1);
	} //end cripta
	
	function cifra($testo, $id_chiave, $n){
		global $base64_chars, $otp;
		$cypher = str_split($testo);
		$cur_otp=substr($otp[$id_chiave], strlen($testo) % 100);
		$cur_otp = str_split($cur_otp);
		for($i=0; $i < strlen($testo); $i++){
			/*$h = strpos($base64_chars, $cypher[$i]);
			$n = strpos($base64_chars, $cur_otp[$i]);
			echo "passo del ciclo $i: cerco $cypher[$i] trovato in $h e $cur_otp[$i] trovato in $n<br />";*/
			$cypher[$i]=substr($base64_chars, (strpos($base64_chars, $cypher[$i]) + $n * strpos($base64_chars, $cur_otp[$i])) % strlen($base64_chars),1);
			//echo "risultato: $cypher[$i]<br />"; 
		}
		//echo "esce dalla fuzione cifra con valore : " . implode($cypher);
		return implode($cypher);
	} //end cifra
	
	function decripta($testo, $id_chiave){
		$testo = str_ireplace(";", "+", $testo);
		return cifra($testo, $id_chiave, -1);
	} //end decripta
	
	function get_url_contents($url){
			$crl = curl_init();
			$timeout = 5;
			curl_setopt ($crl, CURLOPT_URL,$url);
			curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
			curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
			$ret = curl_exec($crl);
			curl_close($crl);
			return $ret;
	} //end get_url_contents
	
 ?>
</body>
</html>